<div class="row toolbar">
  <div class="col-md-6">
    <span class="toolbar-header">
      <%= @appointment.new_record? ? "#{t(:new_appointment)}" : "#{t(:edit)} #{t(:appointment)}" %> 
    </span>
  </div>
  <div class="col-md-6 text-right">
    <ul class="toolbar-nav">
      <li><%= link_to simple_icon("note"), @appointment %></li>
      <li><%= link_to simple_icon("notes"), appointments_path %></li>
    </ul>
  </div>
</div>

<%= form_for(@appointment) do |f| %>
  <% if @appointment.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@appointment.errors.count, "error") %> prohibited this appointment from being saved:</h2>

      <ul>
      <% @appointment.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="form-group">
    <%= f.label :patient_id %><br>
    <%= collection_select(:appointment, :patient_id, Patient.all, :id, :full_name , prompt: true) %>
    <%= link_to feather_icon('circle-plus'), new_patient_path %>
  </div>
  <div class="form-group">
    <%= f.label :staff_id %><br>
    <%= collection_select(:appointment, :staff_id, Staff.all, :id, :full_name , prompt: true) %>
    <%= link_to feather_icon('circle-plus'), new_staff_path %>
  </div>
  <div class="form-group">
    <%= f.label :date_appointment %><br>
    <%= f.date_select :date_appointment %>
  </div>
  <div class="form-group">
    <%= f.label :time_appointment %><br>
    <%= f.time_select :time_appointment %>
  </div>
  <div class="form-group">
    <%= f.label :appointment_status_id %><br>
    <%= collection_select(:appointment, :appointment_status_id, AppointmentStatus.all, :id, :label , prompt: true) %>
    <%= link_to feather_icon('circle-plus'), new_appointment_status_path %>
  </div>
  <div class="form-group">
    <%= f.label :registration_method_id %><br>
    <%= collection_select(:appointment, :registration_method_id, RegistrationMethod.all, :id, :label , prompt: true) %>
    <%= link_to feather_icon('circle-plus'), new_registration_method_path %>
  </div>
  <%= f.submit class: "btn btn-primary" %>
<% end %>
